public class No11{
	 public int minNumberInRotateArray(int [] array) {
    	if(array.length <= 0){
            throw new RuntimeException("GG");
        }
        
        int index1 = 0;
        int index2 = array.length-1;
        int mid = index1;
        while(array[index1] >= array[index2]){
            if(index2-index1 == 1){
                mid = index2;
                break;
            }
            mid = (index1+ index2)/2;
            if(array[index1] == array[index2] && array[index1] == array[mid]){
                return min(array, index1,index2);
            }
            if(array[mid] >= array[index1])
                index1 = mid;
            if(array[mid] <= array[index2])
                index2 = mid;
        }
        return array[mid];
    }
    
    int min(int[] array, int index1, int index2){
        int result = array[index1];
        for(int i = index1 ;i <= index2; i++){
            if(result > array[index1])
                result = array[i];
        }
        return result;
    }
	}